package com.mysoft.gfyx.marketdevelop.controller;

import com.mysoft.framework.modeling.dto.ListDataResult;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.framework.rpc.annotation.PubAction;
import com.mysoft.framework.rpc.annotation.PubService;
import com.mysoft.framework.rpc.contants.RequestPrefix;
import com.mysoft.gfyx.marketdevelop.mip.dto.MySubscriptionDto;
import com.mysoft.gfyx.marketdevelop.mip.dto.MySubscriptionPageDto;
import com.mysoft.gfyx.marketdevelop.mip.dto.MySubscriptionReqDto;
import com.mysoft.gfyx.marketdevelop.service.SearchService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.util.List;

@PubService(value = "/searchOpportunityPub", prefix = RequestPrefix.PUB)
public class SearchOpportunityPubController {
    @Resource
    private SearchService searchService;

    @PubAction(value = "/getLatestOpportunities", method = RequestMethod.POST)
    public MySubscriptionPageDto getLatestOpportunities(@RequestBody MySubscriptionReqDto reqDto) {
        return searchService.getLatestOpportunity(reqDto);
    }

    @PubAction(value = "/searchOpportunity", method = RequestMethod.POST)
    public ListDataResult searchOpportunity(@RequestBody LoadDataParams options) {
        return searchService.loadSearchOpportunityData(options);
    }
}
